<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>天祥瑞饲料</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" id="viewport"
	content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<link href="./css/reset.css" rel="stylesheet" type="text/css">
<link href="./css/pj.css" rel="stylesheet" type="text/css">
<script src="./js/jquery-1.8.3.min.js"></script>
<script src="./js/jquery.raty.js" type="text/javascript"></script>
<!-- 弹出层api -->
<script type="text/javascript" src="js/layer/layer.js"></script>
<script type="text/javascript">
	$(function(){
		var path="<%=request.getSession().getAttribute("path")%>";
		$.post("../../../tszs/txr/pjshopdatails.do?pId=" + $("#pid").val(),
			function(data) {
				var html = "<div class=\"tb-pj-a1\">"
					+ "<a href=\"javascript:findShopDatails('"
					+ data.data[0].product_id
					+ "')\">"
					+ "<span class=\"tbpj-a1-i1\">"
					+ "<img src='/file/"+data.data[0].phtoto+"'></span>"
					+ "<span class=\"tbpj-a1-t1\">"
					+ data.data[0].c_name
					+ "<br>"
					+ data.data[0].c_describe
					+ "</span>"
					+ "<div class=\"tbpj-a1-t1\" style=\"color:#ff2d33\">￥"
					+ data.data[0].u_name + "</div>"
					+ "</a></div>";
			$(".jd-qrdd-bigbox").prepend(html);
		}, "json")
	})
	function findShopDatails(cid) {
		window.location.href = "goods-details.jsp?cid=" + cid;
	}
</script>
</head>
<body>
	<div class="near-box">
		<div class="header">
			<a href="javascript:history.back()" class="left"></a>
			<p class="headerText">发表评论</p>
		</div>
		<div class="jd-qrdd-bigbox">

			<div class="tb-pj-a2">
				<textarea id="content" class="tbpj-a2-input" placeholder="请您对产品评价"></textarea>
			</div>
			<!--  <div class="serve-type-box1">
	       <div class="container">
				<div class="z_photo">
					<span class="serve-type-img2">
			       	  <input class="serve-input" type="file" name="file" id="file" value="" accept="image/*" multiple onchange="imgChange('z_photo','z_file');" />
			           <i class="serve-type-img3"></i>
			           <i class="serve-type-text3">上传凭证</i>
			       </span>
				</div>
				
				<div class="z_mask">
					<div class="z_alert">
						<p>确定要删除这张图片吗？</p>	
						<p>		
							<span class="z_cancel">取消</span>
							<span class="z_sure">确定</span>
						</p>
					</div>
				</div>
			</div>
        </div> -->
			<a href="javascript:pj()"
				style="position: fixed; bottom: 0px; left: 0px; z-index: 9999; width: 100%; text-align: center; color: #FFFFFF; background-color: #FF2d33; padding: 10px 0px; margin-top: 20px; font-size: 16px;">发表评价</a>
		</div>
		<input type="hidden" id="pid" value="<%=request.getParameter("id")%>">
	</div>
	<script src="./js/jquery-1.8.3.min.js"></script>
	<script src="./js/jquery.raty.js" type="text/javascript"></script>
	<script type="text/javascript">
		rat('star1', 'result1', 5);
		rat('star2', 'result2', 1);
		function rat(star, result, m) {

			star = '#' + star;
			result = '#' + result;
			$(result).hide();//将结果DIV隐藏

			$(star).raty({
				hints : [ '10', '20', '30', '40', '50' ],
				path : "images/img",
				starOff : 'star-off-big.png',
				starOn : 'star-on-big.png',
				size : 24,
				start : 40,
				showHalf : true,
				target : result,
				targetKeep : true,//targetKeep 属性设置为true，用户的选择值才会被保持在目标DIV中，否则只是鼠标悬停时有值，而鼠标离开后这个值就会消失
				click : function(score, evt) {
					//第一种方式：直接取值
				}
			});
			/*第二种方式可以设置一个隐蔽的HTML元素来保存用户的选择值，然后可以在脚本里面通过jQuery选中这个元素来处理该值。 弹出结果
			var text = $(result).text();
			$('img').click(function () {
				if ($(result).text() != text) {
					alert('你的评分是'+$(result).text()/m+'分');
					alert(result);
					return;
				}
			});*/
		}

		window.alert = function(name) {
			var iframe = document.createElement("IFRAME");
			iframe.style.display = "none";
			iframe.setAttribute("src", 'data:text/plain,');
			document.documentElement.appendChild(iframe);
			window.frames[0].window.alert(name);
			iframe.parentNode.removeChild(iframe);
		}
		$(".tbpj-a1-i2").click(function() {
			$(this).toggleClass("check");
		});
		function pj() {
			if ($("#content").val() == "") {
				layer.msg("评论内容不能为空！");
				return;
			} else {
				$.post("../../../tszs/txr/insertmessageUpdate.do?pId="
						+ $("#pid").val() + "&mContent=" + $("#content").val(),
						function(data) {
							layer.alert("评论成功！", {title: "提示信息"});
							setTimeout(function(){
								window.location.href = "my-indent-pj.jsp";
							}, 800)
						}, "json");
			}

		}
	</script>
</body>

</html>